import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description: 数组变换
 * User: wangxin
 * Date: 2024-08-09
 * Time: 16:59
 */
public class test1 {

        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            // 注意 hasNext 和 hasNextLine 的区别

            int n = in.nextInt();
            long[] arr = new long[n];

            for(int i = 0;i < arr.length;i++){
                arr[i] = in.nextLong();
            }
            Arrays.sort(arr);
            for(int i = arr.length-1;i>=0;i--){

                while(arr[i] % 2 ==0){
                    arr[i] /= 2;
                }
            }
            for(int i = 1;i < arr.length;i++){
                if(arr[0] != arr[i]){
                    System.out.println("NO");
                    return;
                }
            }
            System.out.println("YES");

        }

}
